//
//  KZCoreBtn.m
//  kangzhipifuyisheng
//
//  Created by 唐开江 on 15/6/13.
//  Copyright (c) 2015年 KangZhi. All rights reserved.
//

#import "KZCoreBtn.h"

@implementation KZCoreBtn

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    [self setAttibute];
}



- (instancetype)initWithFrame:(CGRect)frame

{
    if (self = [super initWithFrame:CGRectMake(frame.origin.x, frame.origin.y, KZCoreBtnW, KZCoreBtnH)]) {
        [self setAttibute];
    }
    return self;
}

- (void)setFrame:(CGRect)frame
{
    //子类中必须关闭autoLayoutSubview.
    [super setFrame:CGRectMake(frame.origin.x, frame.origin.y,KZCoreBtnW,KZCoreBtnH)];
}

- (void)setAttibute
{
    
    if (self.scale) {
        self.layer.cornerRadius = self.width*self.scale;

    }else
    {
        self.layer.cornerRadius = self.width*0.05f;
    
    }
    
    self.layer.borderWidth = 0.5f;
    self.layer.borderColor = [UIColor hexFloatColor:KZCoreBtnBorderColor].CGColor;
    
    self.layer.masksToBounds = YES;
}


@end
